Master Theorem
Tags: #◇CCDSALG #◇Algorithms #◇Computer Science #◇Computational Complexity #◇Efficiency #◇Algorithm Design Paradigms #◇Recursion #◇Recursion and Iteration #◇Analysis of Algorithms #◇Data Structures #◇Time Complexity #◇Space Complexity
◇Overview
The Master Theorem provides a direct way to solve recurrences of the form without step-by-step expansion.
◇Key Concepts
Standard form: Three cases based on comparing with Used to solve ◇Divide and Conquer recurrences quickly Cannot handle all recurrences (non-standard forms require other methods)
◇Details / Theory
Standard Form
The Master Theorem applies to recurrences of the form:
where:
— number of subproblems in the recursion — factor by which the input size is reduced — cost of work done outside the recursive calls (divide + combine)
Critical Value
Compute — this represents the total work done by the leaves of the recursion tree.
The Three Cases
Case 1: If for some
→ The leaf-level work dominates. The recursion tree is bottom-heavy.
Case 2: If
→ Work is evenly distributed across all levels of the tree.
Case 3: If for some , and for some
→ The root-level work dominates. The recursion tree is top-heavy.
Worked Examples
Example 1: Merge Sort —
→ Case 2
Example 2: Binary Search —
→ Case 2
Example 3:
→ Case 1
Limitations
The Master Theorem does not apply when:
is not polynomially comparable to (e.g., in some edge cases) The recurrence is not in the standard form (e.g., ) In these cases, use the ◇Recursion Tree Method or ◇Substitution Method
◇Common Pitfalls
Applying the Master Theorem to non-standard forms like — it only works for divide-type recurrences. Forgetting the regularity condition in Case 3: . Confusing which case applies — always compute first and compare.
◇Summary
TL;DR — The Master Theorem solves recurrences by comparing to across three cases: leaf-heavy, balanced, or root-heavy.
◇Links
Related: ◇Divide and Conquer — ◇Recursion Tree Method — ◇Substitution Method — ◇Asymptotic Notation — ◇Big-O Notation — ◇Big-Theta Notation Source / Reference: Handout 03
◇References & Navigation
- Previous Topic: ◇Lower Bounds
- Next Topic: ◇Nested-Loops
- Related Notes: ◇Divide and Conquer, ◇Recurrences
ACTIVE RECALL VERIFICATION
Select an answer to verify conceptual comprehension and reveal the technical rationale.
What is the primary purpose of the Master Theorem?
In the standard recurrence form , what does represent?
In the standard recurrence form, what does represent?
What is the critical value computed to determine which Master Theorem case applies?
In Case 1 of the Master Theorem, which part of the recursion tree dominates the work?
According to Case 2 of the Master Theorem, if , what is ?
What must be true for Case 3 of the Master Theorem to apply, besides being larger than the critical value?
For Merge Sort, . Which case of the Master Theorem applies?
What is a key limitation of the Master Theorem?
If a recurrence does not fit the Master Theorem, which alternative method is recommended?